﻿using System;
using ITTestingSystem.BusinessLogic.DataServices.Abstract;
using Ninject;

namespace ITTestingSystem.Extentions.Modules.RoleProvider
{
    public class PrimaryRoleProvider : System.Web.Security.RoleProvider
    {
        // ReSharper disable once UnusedAutoPropertyAccessor.Local

        [Inject]
        public IUserService UserService { get; private set; }

        public override bool IsUserInRole(string username, string roleName)
        {
            return string.Compare
                (UserService.GetRoleNameByUserName(username), roleName, StringComparison.OrdinalIgnoreCase) == 0;
        }

        public override string[] GetRolesForUser(string username)
        {
            return new[] { UserService.GetRoleNameByUserName(username) };
        }

        public override void CreateRole(string roleName)
        {
            throw new NotImplementedException();
        }

        public override bool DeleteRole(string roleName, bool throwOnPopulatedRole)
        {
            throw new NotImplementedException();
        }

        public override bool RoleExists(string roleName)
        {
            throw new NotImplementedException();
        }

        public override void AddUsersToRoles(string[] usernames, string[] roleNames)
        {
            throw new NotImplementedException();
        }

        public override void RemoveUsersFromRoles(string[] usernames, string[] roleNames)
        {
            throw new NotImplementedException();
        }

        public override string[] GetUsersInRole(string roleName)
        {
            throw new NotImplementedException();
        }

        public override string[] GetAllRoles()
        {
            throw new NotImplementedException();
        }

        public override string[] FindUsersInRole(string roleName, string usernameToMatch)
        {
            throw new NotImplementedException();
        }

        public override string ApplicationName
        {
            get
            {
                throw new NotImplementedException();
            }
            set
            {
                throw new NotImplementedException();
            }
        }
    }
}